<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>定位的层级</title>
    <style>
        .outer {
            width: 500px;
            background-color: skyblue;
            border: 1px black solid;
            padding: 20px;
            position: relative;
            z-index: 11;
        }

        .box {
            width: 200px;
            height: 200px;
            font-size: 20px;
        }

        .box1 {
            background-color: red;
        }

        .box2 {
            background-color: green;
            position: relative;
            left: 20px;
            bottom: 180px;
        }

        .box3 {
            background-color: blue;
            position: absolute;
            left: 60px;
            top: 60px;
        }

        .box4 {
            background-color: orange;
            position: fixed;
            left: 88px;
            top: 88px;
            z-index: 50;
        }
        .box5 {
            background-color: purple;
            position: fixed;
            left: 108px;
            top: 108px;
            z-index: 10;
        }

    </style>
</head>


<body>
<div class="outer">
    <div class="box box1">1</div>
    <div class="box box2">2</div>
    <div class="box box3">3</div>
    <div class="box box4">4</div>

</div>
<div class="box box5">5</div>
<img src="../../images/层级定位.png" width="450px">
</body>
</html>